package planit.controller.impl;

import java.awt.event.ActionEvent;

import javax.swing.AbstractAction;

import planit.model.Model;
import planit.view.DeletePersonDialog;

@SuppressWarnings("serial")
public class DeletePersonController extends AbstractAction {
	private Model model;

	public DeletePersonController(Model model) {
		this.model = model;
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		DeletePersonDialog dialog = (DeletePersonDialog)this.getValue("DeletePersonDialog");

		model.getSchedule().removePerson(
				model.getSchedule().getPerson(dialog.getPersonId()));
		dialog.updatePersonList();
	}

}
